//
//  FPActorViewCell.m
//  FilmParadise
//
//  Created by lanou3g on 15/7/16.
//  Copyright (c) 2015年 DLYgroup. All rights reserved.
//

#import "FPActorViewCell.h"

@implementation FPActorViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{   CGFloat leftSpace = 10;
    CGFloat upSpace = 10;
    CGFloat rightSpace = 10;
    CGFloat picLabelSpace = 10;
    CGFloat downSpace = 10;
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        //序列号
        self.numLabel = [[UILabel alloc]initWithFrame:CGRectMake(kImageW(leftSpace), kImageH(upSpace), kImageW(20), kImageW(20))];
        self.numLabel.textAlignment = NSTextAlignmentCenter;
        self.numLabel.backgroundColor = [UIColor redColor];
        self.numLabel.layer.cornerRadius = self.numLabel.bounds.size.width/2;
        self.numLabel.layer.masksToBounds = YES;
        [self.contentView addSubview:_numLabel];
        //图片
        self.picImageView = [[UIImageView alloc]initWithFrame:CGRectMake(self.numLabel.width + self.numLabel.x + kImageW(leftSpace), kImageW(upSpace), kImageW(80), kImageH(120))];
        self.picImageView.image = [UIImage imageNamed:@"3.jpg"];
        [self.contentView addSubview:_picImageView];
        
        //中文名
        self.nameCn = [[UILabel alloc]initWithFrame:CGRectMake(self.picImageView.width + self.picImageView.x + kImageW(rightSpace), kImageH(upSpace), kImageW(80), kImageW(20))];
        //  self.filmNameLabel.backgroundColor = [UIColor redColor];
        self.nameCn.font = [UIFont systemFontOfSize:13];
        self.nameCn.text = @"透明人生";
        [self.contentView addSubview:_nameCn];
        //英文名
        self.nameEn = [[UILabel alloc]initWithFrame:CGRectMake(self.nameCn.x,self.nameCn.y + self.nameCn.height , kScreenWidth, kImageW(20))];
        self.nameEn.font = [UIFont systemFontOfSize:11];
        self.nameEn.text = @"Transparent";
        [self.contentView addSubview:_nameEn];
        
        //个人简介
        self.introActor = [[UILabel alloc]initWithFrame:CGRectMake(self.nameEn.x,self.nameEn.y + self.nameEn.height + kImageH(5), kScreenWidth, kImageW(20))];
        self.introActor.text = @"导演:";
        self.introActor.font = [UIFont systemFontOfSize:11];
        [self.contentView addSubview:_introActor];
        
        
        self.summary = [[UILabel alloc]initWithFrame:CGRectMake(self.nameEn.x,self.picImageView.height+self.picImageView.y - kImageH(60),kImageW(200), kImageH(60))];
        self.summary.numberOfLines = 0;
        self.summary.font = [UIFont systemFontOfSize:11];
        [self.contentView addSubview:_summary];
    }
    return self;
}

- (void)cellForModel:(FPActorModel *)model
{
    [self.picImageView sd_setImageWithURL:[NSURL URLWithString:model.posterUrl] placeholderImage:nil completed:nil];
    self.nameCn.text = model.nameCn;
    self.nameEn.text = model.nameEn;
    self.introActor.text = [NSString stringWithFormat:@"%@,生于%@年%@(%@)",model.sex,model.birthYear,model.birthDay,model.birthLocation];
    self.summary.text = model.summary;
}
@end
